package com.xdl.flytest.service;

import com.xdl.flytest.bean.Project;
import com.xdl.flytest.dao.ProjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: 80736
 * @Date: 2018/12/28 18:14
 * @Description:
 */

@Service
public class ProjectService {

    @Autowired
    private ProjectMapper projectMapper;

    public List<Project> getAllProjects() {
        List<Project> projects = projectMapper.selectAllProject();
        return projects;
    }

    public void addProject(Project project) {
        projectMapper.insertSelective(project);
    }

    public Project getProjectByName(String projectName) {
        return projectMapper.selectByProjectName(projectName);
    }

    public void updateProject(Project project) {
        projectMapper.updateByPrimaryKeySelective(project);
    }

    public void deleteProjectById(Integer projectId) {
        projectMapper.deleteByPrimaryKey(projectId);
    }
}
